﻿// default.aspx.cs created with MonoDevelop
// User: armando at 22:40 30/01/2009
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//

using System;
using System.Web;
using System.Web.UI;


namespace webpman
{
	
	
	public partial class @default : System.Web.UI.Page
	{
		
		protected void Page_Load(object sender, EventArgs e)
        {
			// Manager for generic objects, settings, languages and skins
			General GeneralClass = new General();
						
			// Update current webpage with right settings
			Page MyPage = this;
			GeneralClass.SetEnvironment(ref MyPage);
			this.Page = MyPage;
			
			// Init DB and set GeneralClass Object on Master Page
			GeneralClass.DBOpen();
			((master1)this.Master).MasterGeneral = GeneralClass;
			
			
			// Code....
			string EntityManaged, OrderManaged;
			if (Request.QueryString["object"] == null)
			{
				EntityManaged = "project";
				OrderManaged = "";
			}
			else
				EntityManaged = Request.QueryString["object"].ToString();

			
			if (Request.QueryString["order"] == null)
				OrderManaged = "";
			else
				OrderManaged = Request.QueryString["order"].ToString();
			
			
			
			// Update Page
			string RetView = "";
			
			if (Session["USER"] != null)
			{
				
				
				RetView = GeneralClass.DBGetTable(EntityManaged, 
			                                      OrderManaged, 
			                                      Session["USER"].ToString(), 
			                                      Session["AUTH"].ToString(), 
			                                      Request.QueryString);
				RetView = RetView.Replace("<!-- callpage -->", Request.Url.PathAndQuery.Replace("&", "_-_") );
				
			}

			
			resultdiv.InnerHtml = RetView;

			
        }
	}
}
